﻿using LD.Controls;
using System;
using System.Windows.Forms;

namespace LD
{
    public partial class FrmHome : Form
    {
        private ReDrawUI ReDrawUI = new ReDrawUI();
        private FrmSubManager frmsubManager = new FrmSubManager();
        public FrmHome()
        {
            InitializeComponent();
            FormRegister();
        }

        private void FrmHome_Load(object sender, EventArgs e)
        {
            this.Resize += new EventHandler(FrmHome_Resize);
            //ReDrawUI.ControlInitializeSize(this);
        }
        private void FrmHome_Resize(object sender, EventArgs e)
        {
            //ReDrawUI.ControlAutoSize(this);
        }
     
        private void FormRegister()
        {
            MenuLocation ctrlPos = new MenuLocation();
            ctrlPos.Left = 15;
            ctrlPos.Top = 8;
            ctrlPos.Width = 36;
            ctrlPos.Height = 36;
            ctrlPos.Interval = 65;

            frmsubManager.Register("LD.FrmHome", ctrlPos, this.panel_top, this.splitContainer1.Panel1, switchMenu_Click);

            FrmAlarm alarm = new FrmAlarm();
            alarm.TopLevel = false;
            alarm.FormBorderStyle = FormBorderStyle.None;
            alarm.Parent = this.splitContainer1.Panel2;
            alarm.Dock = DockStyle.Fill;
            alarm.Show();
        }
        private void switchMenu_Click(object sender, EventArgs e)
        {
            var swBtn = (SwitchMenu)sender;
            if (swBtn.Tag != null)
                frmsubManager.Show(swBtn.Tag.ToString());
        }
    }
}
